home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Very Best of Atari Inside
/
The Very Best of Atari Inside 1.iso
/
mint
/
mntlb20
/
lib
/
memcmp.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-02-11
|
504b
|
31 lines
/* from Henry Spencer's stringlib */
#include <stddef.h>
#include <string.h>
/*
* memcmp - compare bytes
*/
int /* <0, == 0, >0 */
memcmp(s1, s2, size)
const void * s1;
const void * s2;
size_t size;
{
register const char *scan1;
register const char *scan2;
register size_t n;
scan1 = (const char *) s1;
scan2 = (const char *) s2;
for (n = size; n > 0; n--)
if (*scan1 == *scan2) {
scan1++;
scan2++;
} else
return(*scan1 - *scan2);
return(0);
}